package com.daodway.designpattern.statepattern;

import java.util.Random;

public class DoHouseWork extends State<MinersWife> {
	private static DoHouseWork instance;
	private DoHouseWork(){}
	public static DoHouseWork Instance(){
		if(instance==null){
			instance=new DoHouseWork();
		}
		return instance;
	}
	
	@Override
	public void Enter(MinersWife t) {
		System.out.println(t.entityName+":"+"time to do more housework");
	}

	@Override
	public void Execute(MinersWife t) {
		Random r = new Random();
		int flag=r.nextInt(2);
		if(flag==1){
			System.out.println(t.entityName+":"+"Washing the dishes");
		}else if(flag==0){
			System.out.println(t.entityName+":"+"making the bed");
		}
		
	}

	@Override
	public void Exit(MinersWife t) {
		System.out.println(t.entityName+":"+"making the end");
	}

	@Override
	public boolean OnMessage(MinersWife t, Telegram msg) {
		return false;
	}

}
